using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMEgresos
    {
        public BMEgresos(string coneccion) 
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private Egresos oEgresos = new Egresos();
        private List<Egresos> listaEgresos = new List<Egresos>();
        private DAEgresos daEgresos = new DAEgresos();

        #region BMEgresosSearch
        public List<Egresos> BMEgresosSearch(Egresos egresoD, Egresos egresoH)
        {
            try
            {
                listaEgresos = daEgresos.DAEgresosSearch(connection, egresoD, egresoH);
                return listaEgresos;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMEgresosInsert
        public void BMEgresosInsert(Egresos egreso)
        {
            try
            {
                daEgresos.DAEgresosInsert(connection, egreso);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMEgresosUpdate
        public void BMEgresosUpdate(Egresos egreso)
        {
            try
            {
                daEgresos.DAEgresosUpdate(connection, egreso);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMEgresosGetNext
        public Egresos BMEgresosGetNext()
        {
            try
            {
                oEgresos = daEgresos.DAEgresosGetNext(connection);
                return oEgresos;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMEgresosDelete
        public void BMEgresosDelete(Egresos egreso)
        {
            try
            {
                daEgresos.DAEgresosDelete(connection, egreso);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion
    }
}